package com.gitee.wsl.common.ui.symbol

import androidx.compose.ui.graphics.Path
import com.gitee.wsl.common.ui.base.Point
import com.gitee.wsl.common.ui.ext.path.arc
import com.gitee.wsl.common.ui.symbol.generator.pi
import com.gitee.wsl.common.ui.symbol.generator.tau
import com.gitee.wsl.mathematics.geometry.shape.Circle

fun Symbol.Companion.circle(position: Point = Point(), radius: Float = 1.0f) = Circle(position, radius)

fun Path.circle(circle: Circle){
    with(circle) {
        moveTo(position.x + radius, position.y)
        arc(
            centerX = position.x,
            centerY = position.y,
            radius = radius,
            startAngle = .0f,
            endAngle = pi
        )
        arc(
            centerX = position.x,
            centerY = position.y,
            radius = radius,
            startAngle = pi,
            endAngle = tau
        )
        close()
    }
}

fun Path.circle( center: Point, radius: Float) = circle(Circle(center, radius))

